import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogActions, MatDialogContent, MatDialogTitle } from '@angular/material/dialog';
import { file, fileInfoBaseDto, folder } from 'ispace.core.main';
import { PropertyPageComponent } from '../../page/property-page/property-page.component';
import { CommonModule } from '@angular/common';

@Component({
  selector: 'app-properties-cmp',
  standalone: true,
  imports: [CommonModule, PropertyPageComponent,     MatDialogTitle,
      MatDialogContent,
      MatDialogActions, ],
  templateUrl: './properties-cmp.component.html',
  styleUrl: './properties-cmp.component.scss'
})
export class PropertiesCmpComponent {

  fileData!:fileInfoBaseDto;

  constructor(@Inject(MAT_DIALOG_DATA) public data: any) { 
    if(this.data.type == 'file'){
     file.statf(this.data.path).subscribe(s => {
        this.fileData = s;
     }) 
    }
    else{
      folder.statf(this.data.path).subscribe(s => {
        this.fileData = s;
      })
    }
  }
}
